package com.hkts.reportform.config;

import com.hkts.reportform.datastatics.dao.ReportDao;
import com.hkts.reportform.datastatics.entity.ReportForm;
import com.hkts.reportform.datastatics.service.ReportService;
import com.hkts.reportform.utils.InventoryClassFildes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassNameCommandLineRunnerTest
 * @Description
 * @Author yck
 * @Date2020-11-02 13:36
 * @Version V1.0
 **/
//@Component
//@Order(1)
public class CommandLineRunnerDataInit implements ApplicationRunner {
    @Autowired
    private ReportService reportServiceImpl;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        Long startTime = System.currentTimeMillis();
        reportServiceImpl.stockDataInit();
        Long endTime = System.currentTimeMillis();
        Long tempTime = (endTime - startTime);
        System.out.println("数据初始化花费时间："+
                (((tempTime/86400000)>0)?((tempTime/86400000)+"d"):"")+
                ((((tempTime/86400000)>0)||((tempTime%86400000/3600000)>0))?((tempTime%86400000/3600000)+"h"):(""))+
                ((((tempTime/3600000)>0)||((tempTime%3600000/60000)>0))?((tempTime%3600000/60000)+"m"):(""))+
                ((((tempTime/60000)>0)||((tempTime%60000/1000)>0))?((tempTime%60000/1000)+"s"):(""))+
                ((tempTime%1000)+"ms"));
    }
}
